<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>index</title>
    <script src="/jquery.js"></script>
    <script>
        $(function () {
            $("#cs").click(function () {
                /*$.ajax({
                    url:"/course/addcourse",
                    type:"post",
                    /!*
                     指定发送的数据类型是json串，配合@RequestBody就可以将json串转换成对象
                    *!/
                    contentType:"application/json;charset=utf-8",
                    data:'{"cid":'+$("#cid").val()+',"cname":'+$("#cname").val()+'}',
                    success:function (data) {
                        console.log(data);
                    }
                });*/
                $.ajax({
                    url:"http://localhost:8888/course/courses",
                    success:function (data) {
                        console.log(data);
                    }
                });
            });
        })
    </script>
</head>
<body>

 <form method="post">
     图书编号：<input id="cid" type="text" name="cid" />
     图书名：  <input id="cname" type="text" name="cname" />
               <input id="btn" type="button" value="提交" /><br>
               <input id="cs" type="button" value="测试" />
 </form>
</body>
</html>